package com.smart.community.feign.property;

import com.smart.community.feign.property.fallback.PropertyStatisticsFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 物业统计Feign接口
 * 提供物业费、维修申请等统计相关的远程调用接口
 * 
 * @author Wu.Liang
 * @version 1.0.0
 * @since 2025-01-30
 */
@FeignClient(name = "smart-community-property", 
             path = "/feign/property", 
             fallbackFactory = PropertyStatisticsFeignFallbackFactory.class,
             contextId = "propertyStatisticsFeign")
public interface IPropertyStatisticsFeign {
    
    /**
     * 根据社区ID列表获取物业费趋势数据
     * 
     * @param communityIds 社区ID列表
     * @param months 统计月份数，默认6个月
     * @return 每月物业费数据列表
     */
    @PostMapping("/statistics/property-fee-trend")
    List<Integer> getPropertyFeeTrend(@RequestBody List<Long> communityIds, 
                                     @RequestParam(value = "months", defaultValue = "6") Integer months);
    
    /**
     * 根据物业公司ID列表获取物业费趋势数据
     * 
     * @param propertyCompanyIds 物业公司ID列表
     * @param months 统计月份数，默认6个月
     * @return 每月物业费数据列表
     */
    @PostMapping("/statistics/property-fee-trend/by-companies")
    List<Integer> getPropertyFeeTrendByCompanies(@RequestBody List<Long> propertyCompanyIds, 
                                                @RequestParam(value = "months", defaultValue = "6") Integer months);
    
    /**
     * 根据社区ID列表获取维修申请趋势数据
     * 
     * @param communityIds 社区ID列表
     * @param months 统计月份数，默认6个月
     * @return 每月维修申请数据列表
     */
    @PostMapping("/statistics/repair-application-trend")
    List<Integer> getRepairApplicationTrend(@RequestBody List<Long> communityIds, 
                                           @RequestParam(value = "months", defaultValue = "6") Integer months);
    
    /**
     * 根据物业公司ID列表获取维修申请趋势数据
     * 
     * @param propertyCompanyIds 物业公司ID列表
     * @param months 统计月份数，默认6个月
     * @return 每月维修申请数据列表
     */
    @PostMapping("/statistics/repair-application-trend/by-companies")
    List<Integer> getRepairApplicationTrendByCompanies(@RequestBody List<Long> propertyCompanyIds, 
                                                       @RequestParam(value = "months", defaultValue = "6") Integer months);
}
